package com.foreknow.elm.service.Impl;

import com.foreknow.elm.dao.FoodDao;
import com.foreknow.elm.dao.Impl.FoodDaoImpl;
import com.foreknow.elm.po.Food;
import com.foreknow.elm.service.FoodService;
import com.foreknow.elm.util.DBUtil;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class FoodServiceImpl implements FoodService {
    @Override
    public List<Food> listFoodByBusinessId(Integer businessId) {
        List<Food> list=new ArrayList<>();
        FoodDao foodDao=new FoodDaoImpl();
        try {
            list=foodDao.listFoodByBusinessId(businessId);
        } catch (SQLException e) {
            e.printStackTrace();
        }finally {
            DBUtil.close();
        }
        return list;
    }

    public static void main(String[] args) {
//        FoodService foodService=new FoodServiceImpl();
//        List<Food> list= foodService.listFoodByBusinessId(10001);
//        for (int i=0;i< list.size();i++){
//            System.out.println(list.get(i).getFoodName());
//        }
    }
}
